<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<link rel="shortcut icon" href="favicon.ico">
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
<link th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								公司名称：<input type="text" name="syscName"/>
							</li>


							<li>
								地址：<input type="text" name="syscAddress"/>
							</li>


							<li>
								邮箱：<input type="text" name="syscMail"/>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="gxgw_modules:systemConfig:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="gxgw_modules:systemConfig:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="gxgw_modules:systemConfig:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="gxgw_modules:systemConfig:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('gxgw_modules:systemConfig:edit')}]];
        var removeFlag = [[${@permission.hasPermi('gxgw_modules:systemConfig:remove')}]];
        var editLogoFlag = [[${@permission.hasPermi('gxgw_modules:systemConfig:editLogo')}]];
        var prefix = ctx + "gxgw_modules/systemConfig";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
				updateLogo:prefix+"/editLogo/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "系统配置",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'syscId', 
					title : '序号',
					visible: true
				},
				{
					field : 'syscName', 
					title : '公司名称',
					sortable: true
				},
				{
					field : 'syscLogo', 
					title : '公司logo',
					sortable: false,
                    formatter: function (value) {
                        switch (value) {
							case '无':
							    return "无"
							default:
                                return '<img alt="image" class="img-circle m-t-xs img-responsive" src="/profile/logo/'+value+'"  />';
                        }
						/*var s=[[@{/profile/logo/+value}]];*/
                    }
				},
				{
					field : 'syscContact', 
					title : '联系方式',
					sortable: true
				},
				{
					field : 'syscAddress', 
					title : '地址',
					sortable: true
				},
				{
					field : 'syscUrl', 
					title : '网址',
					sortable: true
				},
				{
					field : 'syscMail', 
					title : '邮箱',
					sortable: true
				},
				{
					field : 'syscProtocol', 
					title : '服务协议',
					sortable: true
				},
				{
					field : 'syscGuide', 
					title : '用户指南',
					sortable: true
				},

		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editLogoFlag + '" href="#" onclick="editLogo(\'' + row.syscId + '\')"><i class="fa fa-edit"></i>编辑logo</a> ');
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.syscId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.syscId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });



        // 修改logo
        function editLogo(id) {
            var url = "/404.html";
            if ($.common.isNotEmpty(id)) {
                url = $.table._option.updateLogo.replace("{id}", id);
            } else {
                var id = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
                if (id.length == 0) {
                    $.modal.alertWarning("请至少选择一条记录");
                    return;
                }
                url = $.table._option.updateLogo.replace("{id}", id);
            }

            $.modal.open("修改" + $.table._option.modalName+"LOGO", url);
        }
    </script>
</body>
</html>